#coding:utf-8
"""
Django settings for pythonems project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '*8k=vq%zxhd__)h(=zom9e!ckrtdc^0d)610o4^l-a-52pdy1+'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

TEMPLATE_DEBUG = False

ALLOWED_HOSTS = ["*"]


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'major',
    'questioin',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'pythonems.urls'

WSGI_APPLICATION = 'pythonems.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        #'TEST_NAME':  os.path.join(BASE_DIR, 'db_test.sqlite3'),
    },
    'OPTIONS': {
        'timeout': 20,
    }
}

"""DATABASES = {
    'default': {
        'ENGINE':'django.db.backends.mysql',
        'NAME': 'PythonEms',
        'USER': 'PythonEmsAdmin',
        'PASSWORD': 'PythonEms_school_Admin_MySQL',
        'HOST': 'PythonEmsDB',
        'PORT': '3306',
    }
}
"""

MONGO_DATABASES  = {
    "host": "127.0.0.1",
    "port": 27017,
    "name": "PythonEms",
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'zh-cn'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_URL = '/static/'
UPLOAD_ROOT = os.path.join(BASE_DIR, 'upload/')
UPLOAD_URL = '/upload/'

"""STATICFILES_DIRS = (
    'static',
)"""

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

LOGIN_REDIRECT_URL = "/manager/major/"
LOGIN_URL = "/accounts/login/"

SESSION_EXPIRE_AT_BROWSER_CLOSE = True